N=10; M=10; stairs=[|1,0,0,0,1,1,0,1,1,0| 1,1,0,0,1,0,1,0,0,0| 1,1,1,1,1,1,1,1,0,0| 1,1,1,1,0,0,1,0,1,1| 1,1,1,0,1,0,1,1,1,1| 1,1,0,0,1,0,1,1,1,1| 1,1,0,1,1,0,1,0,0,0| 1,1,0,0,0,1,1,0,1,1| 1,1,1,0,0,0,1,1,0,1| 1,1,1,1,0,1,0,0,1,1|]; number=[|3,8,8,4,8,9,4,10,4,7| 3,10,5,4,1,10,4,6,4,1| 3,9,5,8,6,4,7,8,7,10| 9,7,1,1,6,4,7,1,7,3| 1,8,3,3,3,3,8,5,3,8| 4,8,10,10,6,7,7,9,7,6| 4,7,10,7,8,2,10,8,9,10| 2,2,3,4,2,1,2,5,7,6| 6,10,5,6,3,3,1,6,4,4| 8,3,7,6,2,3,3,2,1,1|]; p=8;